package com.cens.mall.order.listener;

import com.cens.mall.order.config.AlipayTemplate;
import com.cens.mall.order.service.OrderService;
import com.cens.mall.order.vo.PayAsyncVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
public class OrderPayedListener {

    @Autowired
    AlipayTemplate alipayTemplate;

    @Autowired
    private OrderService orderService;

    @PostMapping("/payed/notify")
    public String handleAliPayed(PayAsyncVo vo,HttpServletRequest request){
//        Map<String, String[]> parameterMap = request.getParameterMap();
        String result = orderService.handlePayResult(vo);
        return result;
    }
}
